stock = 0 # Initial stock

def purchase(amount):
    global stock
    stock += amount
    print("Purchased:", amount)
    print("Current stock:", stock)

def sell(amount):
    global stock
    if stock < amount:
        print("Error: Not enough stock")
    else:
        stock -= amount
        print("Sold:", amount)
        print("Current stock:", stock)

print("Stock Management System")
while True:
    choice = input("Enter choice (purchase, sell, exit):")
    if choice == "purchase":
        amount = int(input("Enter amount:"))
        purchase(amount)
    elif choice == "sell":
        amount = int(input("Enter amount:"))
        sell(amount)
    elif choice == "exit":
        break
    else:
        print("Error: Invalid input")
